home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{9FE255D1-F32E-11D0-9E15-444553540000}#1.0#0"; "MLISTX.OCX"
- Begin VB.Form frmSort
- BorderStyle = 0 'None
- ClientHeight = 5835
- ClientLeft = 3630
- ClientTop = 5115
- ClientWidth = 7830
- ControlBox = 0 'False
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 5835
- ScaleWidth = 7830
- ShowInTaskbar = 0 'False
- Begin VB.CheckBox Check1
- Caption = "Sort Column 1 Numerically"
- Height = 330
- Left = 4500
- TabIndex = 8
- Top = 3375
- Value = 1 'Checked
- Width = 2505
- End
- Begin VB.Frame Frame2
- Caption = "Sort Column 2"
- Height = 885
- Left = 1815
- TabIndex = 4
- Top = 4740
- Width = 1395
- Begin VB.OptionButton optSort
- Caption = "Ascending"
- Height = 270
- Index = 2
- Left = 105
- TabIndex = 6
- Top = 255
- Value = -1 'True
- Width = 1260
- End
- Begin VB.OptionButton optSort
- Caption = "Descending"
- Height = 270
- Index = 3
- Left = 105
- TabIndex = 5
- Top = 480
- Width = 1155
- End
- End
- Begin VB.Frame Frame1
- Caption = "Sort Column 1"
- Height = 885
- Left = 360
- TabIndex = 1
- Top = 4740
- Width = 1395
- Begin VB.OptionButton optSort
- Caption = "Descending"
- Height = 270
- Index = 1
- Left = 105
- TabIndex = 3
- Top = 480
- Width = 1155
- End
- Begin VB.OptionButton optSort
- Caption = "Ascending"
- Height = 270
- Index = 0
- Left = 90
- TabIndex = 2
- Top = 255
- Value = -1 'True
- Width = 1200
- End
- End
- Begin MabryCtl.MList MList1
- Height = 4215
- Left = 360
- TabIndex = 0
- Top = 360
- Width = 2925
- _ExtentX = 5159
- _ExtentY = 7435
- BackColor = 16777215
- Caption = "Caption"
- CaptionAlignment= 2
- Object.TabStop = -1 'True
- ThreedShadowColor= -2147483627
- MousePointer = -842150451
- MultiSelect = 1
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- BeginProperty Columns {23BAA6DE-05A6-11D1-9E15-0020AFD6A9D5}
- ColumnCount = 2
- BeginProperty Column0 {23BAA6E0-05A6-11D1-9E15-0020AFD6A9D5}
- Object.Width = 40
- MinWidth = 0
- MaxWidth = -1
- UserResizeEnabled= -1
- Heading = "Col 1"
- Object.Visible = -1
- ColumnAlignment = 0
- HeadingAlignment= 0
- EndProperty
- BeginProperty Column1 {23BAA6E0-05A6-11D1-9E15-0020AFD6A9D5}
- Object.Width = 40
- MinWidth = 0
- MaxWidth = -1
- UserResizeEnabled= -1
- Heading = "Col 2"
- Object.Visible = -1
- ColumnAlignment = 0
- HeadingAlignment= 0
- EndProperty
- EndProperty
- End
- Begin VB.Label Label2
- Alignment = 2 'Center
- Caption = "List/X Does It All!"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FF0000&
- Height = 405
- Left = 3585
- TabIndex = 9
- Top = 3915
- Width = 3960
- End
- Begin VB.Label Label1
- Caption = $"Sort.frx":0000
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2790
- Left = 3525
- TabIndex = 7
- Top = 330
- Width = 4020
- End
- Attribute VB_Name = "frmSort"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Check1_Click()
- Dim foo As CSort
- ' VB needs a little help understanding what object
- ' is being returned by SortObject
- Set foo = MList1.Columns(0).SortObject
- If (Check1.Value = 1) Then
- foo.NumericSort = True
- Else
- foo.NumericSort = False
- End If
- ' Force a resort
- MList1.Sorted = False
- MList1.Sorted = True
- End Sub
- Private Sub Form_Load()
- Dim i As Integer
- Dim j As Integer
- Dim sorter As CSort
- ' Add something sortable to the listbox
- For i = 1 To 27 Step 3
- For j = 1 To 5
- MList1.AddItem i & "," & j
- Next
- Next
- ' Assign the sort object to column zero. You can
- ' assign the same or different sort objects to
- ' as many columns as the listbox has.
- Set sorter = New CSort
- MList1.Columns(0).SortObject = sorter
- ' Set sort type
- sorter.NumericSort = True
- ' Set sortorder, ascending for both columns
- MList1.sortorder = "a a"
- ' Enable sorting, the sorter's comparison method
- ' is going to get called during the sort
- MList1.Sorted = True
- End Sub
- Private Sub optSort_Click(Index As Integer)
- Dim sortorder As String
- ' One of the sortorder options changed, build
- ' new sort order string
- If (optSort(0)) Then
- sortorder = "0a "
- Else
- sortorder = "0d "
- End If
- If (optSort(2)) Then
- sortorder = sortorder & "1a"
- Else
- sortorder = sortorder & "1d"
- End If
- ' Assign sort order string, since MList1.Sort = True
- ' sorting happens immediately
- MList1.sortorder = sortorder
- End Sub
-